<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8"/>
    <title>REST Tester</title>
    <meta name="description" content="rest"/>
    <link rel="stylesheet" type="text/css" href="${ctx}/static/css/config.css"/>
</head>
<body>
<div class="config-block">
    <form action="${ctx}/rest/test" method="post" enctype="multipart/form-data">
        <div class="config-block">
            <div class="config-item">
                <span class="config-item-title">Resource Url</span>
                <input class="config-item-input" type="text" id="resource_url" name="resource_url" title="Resource Url" value="${resource_url}"/>
            </div>
            <div class="config-item">
                <span class="config-item-title">Request Message</span>
                <input class="config-item-input" type="file" id="request_message" name="request_message" title="Request Message" />
            </div>
            <div class="config-item">
                <span class="config-item-title">Direct Call CRM Service?</span>
                <input class="config-item-checkbox" type="checkbox" id="direct_call_crm_service" name="direct_call_crm_service" title="Direct Call CRM Service?"
                onchange="appendServiceCodeInput()"/>
            </div>
            <div id="div_service_code">
            </div>
            <div class="config-item">
                <span class="config-item-title">Routing Zone Id</span>
                <input class="config-item-input" type="text" id="routing_zone_id" name="routing_zone_id" title="routing_zone_id" value="${routing_zone_id}"/>
            </div>
            <div class="config-item">
                <span class="config-item-title">Connection Timeout(60000)</span>
                <input class="config-item-input" type="text" id="connection_timeout" name="connection_timeout" title="Connection Timeout" value="${connection_timeout}"/>
            </div>
            <div class="config-item">
                <span class="config-item-title">Read Timeout(60000)</span>
                <input class="config-item-input" type="text" id="read_timeout" name="read_timeout" title="Read Timeout" value="${read_timeout}"/>
            </div>
            <div class="config-item">
                <span class="config-item-title">Submit</span>
                <button class="config-button" type="submit" id="submitBtn" name="submitBtn">Test</button>
            </div>
            <div class="config-item">
                <span class="config-item-title">Error Message</span>
                <textarea class="config-item-error" id="error_message" name="error_message" title="Error Message">${error_message}</textarea>
            </div>
            <div class="config-item">
                <span class="config-item-title">Process Time</span>
                <input class="config-item-input" type="text" id="process_time" name="process_time" title="process_time" value="${process_time}"/>
            </div>
        </div>
    </form>
</div>
<span style="clear:both; z-index:1000; overflow:hidden; bottom:10px; left:5px;position:fixed !important;color: #e9e9e9">Author: Charkey@ODC;Cooperator: 大头森@ODC</span>
<script type="application/javascript" src="${ctx}/static/jquery-2.0.3.min.js"></script>
<script type="application/javascript">
    function selectQueueName() {
        $("#queue_name").val($("#queue_name_list").find("option:selected").text());
    }
    function appendServiceCodeInput() {
        var serviceCodeDiv = $("#div_service_code");
        if ($("#direct_call_crm_service").is(':checked')) {
            serviceCodeDiv.html("<span class=\"config-item-title\">Service Code</span>\n<input class=\"config-item-input\" type=\"text\" id=\"service_code\" name=\"service_code\" title=\"Service Code\"/>");
            serviceCodeDiv.attr("class", "config-item");
        } else {
            serviceCodeDiv.html("");
            serviceCodeDiv.removeAttr("class");
        }
    }
</script>
</body>
</html>

